		<?php 
			include($_SERVER['DOCUMENT_ROOT']."/headerins.php");
		?>

<?php

include($_SERVER['DOCUMENT_ROOT']."/headerFrame.php");

echo '
        <div id="contextCaption">Просморт справочника ед. измерения</div>
        <hr>
            <table border="0" id="contextGrid" cellspacing="0">
                <thead>
                    <tr>
                        <th>№</th>
                       <th>Название</th>
					   <th>Изм</th>
					   <th>Уд</th>
                    </tr>
                </thead>
                <tbody>
';
?>
         
       <?php

                  
                          $sql = '
                        	SELECT
                                    id, name
                                FROM matdimension 
                          ';
                          $result = mysql_query($sql);
                            if (!$result) {
                                echo 'Ошибка запроса: ' . mysql_error();
                                exit;
                            }
                          while($row = mysql_fetch_array($result)){
                              echo "<tr>";
                              echo "<td> " .$row['id']. "</td>";
                              echo "<td> " . $row['name'] . "</td>";

							  echo "<td style='padding: 0px;'>  
								<img onclick=".'"'."getPage('/core/Dimension/DimensionUpdate.php?id=".$row['id']."&name=".str_replace(" ", "%20", $row['name'])."')".'"'." 
								src='/../images/edit.png' title='Изменить' width=16 height=16> </td>";
                              echo "<td	style='padding: 0px;'>  <img onclick=".'"'."Request('Dimension','delete', '".$row['id']."')".'"'." 
								src='/../images/delete.png' title='Удалить' width=16 height=16> </td>";
                              echo "</tr>";
                            }

                          mysql_close($con);
                ?>                

<?php

echo "
                </tbody>
            </table>
            <hr>
            <input id='button' type='Button'  value='Закрыть' title='закрыть' onclick=".'"'."getPage('/core/context/context.html')".'"'.">            
            <input id='button' type='Button' onclick=".'"'."getPage('/core/Dimension/DimensionInsert.php')".'"'." value='Создать' title='Создать'>
";
?>
